#### AUDREY LATURA AND JULIE WEAVER
## R Code for replication paper
## Paper Submitted 2 May 2014


setwd("/Users/audreylatura/dropbox/Harvard/Harvard Spring 2014/GOV 2001 - Advanced Quant/Replication Paper")
setwd("/Users/julieanneweaver/Documents/Spring 2014/Gov 2001/Replication paper/Data")

library(foreign)
data <- read.dta("JOPgender_replication_minversion.dta")


### this R Code contains the following 4 sections:

## Part 1: Logit Model
## Logit model first differences
## Part 2: Ordered Logit Model
## Ordered Logit first differences 

#################################################
#################################################  PART 1: LOGIT MODEL
#################### LOGIT MODELS FOR 6 DVS: MEMBERSHIP ON COMMITTEE PER TYPE


### CLEANING AND SUBSETTING THE DATA:

## Subsetting the data per authors' do file for their original logit model (DV = committee chair), 
### except they originally took out minorparties_dum2==0
## because no one from a minor party was a committee chair

### to check that there people who are from minor parties are on each kind of committee:

summary(data$minorparties_dum2==1) ## only 47 of them

data.minorparties <- data[data$minorparties_dum2==1,] ## creating a dataset with the 47 obs of minor parties
summary(data.minorparties) ### and you can see that for each type of committee, there are people
### who are members


### now making the dataset:


data.logit.inov <- data[data$unit_individual==0 & 
                          data$alternate==0,]

names(data)

##Coding education variable as numeric:
data.logit.inov$educ_level2_nums <- as.numeric(data.logit.inov$educ_level2)


#### pulling out only the columns we need

data.logit.inov <- data.logit.inov[,c("women_memA","burden_memA", "economic_memA", "foreign_memA", 
                                      "issue_memA", "power_memA", "social_memA", "female", "committee_chair", 
                                      "educ_level2_nums", "p_diputadolocal",
                                      "p_feddeputy", "p_senador", "p_statepartyleader",
                                      "p_natpartyleader", "jcp", "mesadirectiva", 
                                      "tier", "prddummy", "pandummy", "pvemdummy", 
                                      "ptdummy", "convdummy", "nadummy", "dum2003", 
                                      "dum2006", "female2003", "female2006", 
                                      "wnom1_dist_chambermed", "committee_secretary",
                                      "party_leader", "minorparties_dum2",
                                      "daysinoffice_log")]

### removing NAs: started with 1503

data.logit.inov <- na.omit(data.logit.inov) ## now have 1469 observations


################################################# LOGIT MODEL I -  WOMEN'S COMMITTEES
################### DV = women_memA

##First we need to make women_memA a 0/1 dichotomous variable.

## just to be sure, lets see a summary of original women_memA variable:

summary(data.logit.inov$women_memA) # mean = 0.09054, max = 2
sum(data.logit.inov$women_memA) ## 133
sum(data.logit.inov$women_memA[data.logit.inov$women_memA==1]) ## 125 1's
sum(data.logit.inov$women_memA[data.logit.inov$women_memA==2]) ## 8 so there are 4 2's
length(data.logit.inov$women_memA[data.logit.inov$women_memA==0]) ### 1340 0's
length(data.logit.inov$women_memA[data.logit.inov$women_memA==1]) ### 125 1's
length(data.logit.inov$women_memA[data.logit.inov$women_memA==2]) ### 4 2's
1340/1469 # so 0.9121852 of the distribution is 0

summary(is.na(data.logit.inov$women_memA)) ## so no NA's

### so with our new binary variable, we should have 1340 0's and 129 1's

### creating the binary variable:
##Add new placeholding column to data set
data.logit.inov$women_memA.dum <- rep(15,nrow(data.logit.inov))##15 just a rando placeholder
is.numeric(data.logit.inov$women_memA.dum)


##Populate the new dummy, where TRUE will equal 1, FALSE will equal 0
data.logit.inov$women_memA.dum<-data.logit.inov$women_memA >= 1

##Turn these trues and falses into 1s and 0s with as.numeric
data.logit.inov$women_memA.dum<-as.numeric(data.logit.inov$women_memA.dum)

### to double check it worked
summary(data.logit.inov$women_memA.dum) ### mean = .08781
length(data.logit.inov$women_memA.dum[data.logit.inov$women_memA.dum==0]) ### 1340 0's
length(data.logit.inov$women_memA.dum[data.logit.inov$women_memA.dum==1]) ### 129 1's


## running the logit model

library(Zelig)
zelig.logit.inov.women <- zelig(women_memA.dum ~ female + committee_chair + educ_level2_nums + p_diputadolocal
                                + p_feddeputy +  p_senador + p_statepartyleader + p_natpartyleader
                                + jcp + mesadirectiva + tier
                                + prddummy + pandummy + pvemdummy + ptdummy + convdummy
                                + nadummy + dum2003 + dum2006 + female2003 
                                + female2006 + wnom1_dist_chambermed 
                                + committee_secretary
                                + party_leader + minorparties_dum2 + daysinoffice_log,
                                data = data.logit.inov, model = "logit")


summary(zelig.logit.inov.women)  



################################################# LOGIT MODEL -  ECONOMIC COMMITTEES
################### DV = economic_memA

### looking at original economic_memA variable to double check with new dummy:

summary(data.logit.inov$economic_memA)
length(data.logit.inov$economic_memA[data.logit.inov$economic_memA==0]) ### 991 0's
length(data.logit.inov$economic_memA[data.logit.inov$economic_memA==1]) ### 408 1's
length(data.logit.inov$economic_memA[data.logit.inov$economic_memA==2]) ### 68 2's
length(data.logit.inov$economic_memA[data.logit.inov$economic_memA==3]) ### 2 3's
991 + 408 + 68 + 2 # = 1469 so that matches our n

summary(is.na(data.logit.inov$economic_memA)) ## no NA's

### so when we transform the variable into the new dummy, we will want 991 0's and 478 1's


##First we need to make economic_memA a 0/1 dichotomous variable.

##Add new placeholding column to data set
data.logit.inov$economic_memA.dum <- rep(15,nrow(data.logit.inov))##15 just a rando placeholder
is.numeric(data.logit.inov$economic_memA.dum)

##Populate the new dummy, where TRUE will equal 1, FALSE will equal 0
data.logit.inov$economic_memA.dum<-data.logit.inov$economic_memA >= 1


##Turn these trues and falses into 1s and 0s with as.numeric
data.logit.inov$economic_memA.dum<-as.numeric(data.logit.inov$economic_memA.dum)

##### double checking the new dummy variable
length(data.logit.inov$economic_memA.dum[data.logit.inov$economic_memA.dum==0]) ## 991 0's
length(data.logit.inov$economic_memA.dum[data.logit.inov$economic_memA.dum==1]) ## 478 1's
#### so it worked!!!!!


### now doing the logit with DV = economic_memA.dum

zelig.logit.inov.econ <- zelig(economic_memA.dum ~ female + committee_chair + educ_level2_nums + p_diputadolocal
                               + p_feddeputy +  p_senador + p_statepartyleader + p_natpartyleader
                               + jcp + mesadirectiva + tier
                               + prddummy + pandummy + pvemdummy + ptdummy + convdummy
                               + nadummy + dum2003 + dum2006 + female2003 
                               + female2006 + wnom1_dist_chambermed 
                               + committee_secretary
                               + party_leader + minorparties_dum2 + daysinoffice_log,
                               data = data.logit.inov, model = "logit")

summary(zelig.logit.inov.econ)


########################################
################################################# LOGIT MODEL -  POWER COMMITTEES
################### DV = power_memA

# original power_memA to double check with new dummy:

summary(data.logit.inov$power_memA)
length(data.logit.inov$power_memA[data.logit.inov$power_memA==0]) ### 1031 0's
length(data.logit.inov$power_memA[data.logit.inov$power_memA==1]) ### 336 1's
length(data.logit.inov$power_memA[data.logit.inov$power_memA==2]) ### 93 2's
length(data.logit.inov$power_memA[data.logit.inov$power_memA==3]) ### 9 3's
1031 + 336 + 93 + 9 # = 1469 so that matches our n

summary(is.na(data.logit.inov$economic_memA)) ## no NA's

### so when we transform the variable into the new dummy, we will want 1031 0's and 438 1's
1031 + 438 # = 1469



##Add new placeholding column to data set
data.logit.inov$power_memA.dum <- rep(15,nrow(data.logit.inov))##15 just a rando placeholder
is.numeric(data.logit.inov$power_memA.dum)

##Populate the new dummy, where TRUE will equal 1, FALSE will equal 0
data.logit.inov$power_memA.dum<-data.logit.inov$power_memA >= 1


##Turn these trues and falses into 1s and 0s with as.numeric
data.logit.inov$power_memA.dum<-as.numeric(data.logit.inov$power_memA.dum)


zelig.logit.inov.power <- zelig(power_memA.dum ~ female + committee_chair + educ_level2_nums + p_diputadolocal
                                + p_feddeputy +  p_senador + p_statepartyleader + p_natpartyleader
                                + jcp + mesadirectiva + tier
                                + prddummy + pandummy + pvemdummy + ptdummy + convdummy
                                + nadummy + dum2003 + dum2006 + female2003 
                                + female2006 + wnom1_dist_chambermed 
                                + committee_secretary
                                + party_leader + minorparties_dum2 + daysinoffice_log,
                                data = data.logit.inov, model = "logit")

summary(zelig.logit.inov.power)



########################################
################################################# LOGIT MODEL -  BURDEN COMMITTEES
################### DV = burden_memA


#####  original burden_memA to double check with new dummy:

summary(data.logit.inov$burden_memA)
length(data.logit.inov$burden_memA[data.logit.inov$burden_memA==0]) ### 969 0's
length(data.logit.inov$burden_memA[data.logit.inov$burden_memA==1]) ### 433 1's
length(data.logit.inov$burden_memA[data.logit.inov$burden_memA==2]) ### 66 2's
length(data.logit.inov$burden_memA[data.logit.inov$burden_memA==3]) ### 1 3's
969 + 433 + 66 + 1 # = 1469 so that matches our n

summary(is.na(data.logit.inov$burden_memA)) ## no NA's

### so when we transform the variable into the new dummy, we will want 969 0's and 500 1's
969 + 500 # = 1469



##First we need to make burden_memA a 0/1 dichotomous variable.


##Add new placeholding column to data set
data.logit.inov$burden_memA.dum <- rep(15,nrow(data.logit.inov))##15 just a rando placeholder
is.numeric(data.logit.inov$burden_memA.dum)

##Populate the new dummy, where TRUE will equal 1, FALSE will equal 0
data.logit.inov$burden_memA.dum<-data.logit.inov$burden_memA >= 1


##Turn these trues and falses into 1s and 0s with as.numeric
data.logit.inov$burden_memA.dum<-as.numeric(data.logit.inov$burden_memA.dum)

### to double check it worked
summary(data.logit.inov$burden_memA.dum)
length(data.logit.inov$burden_memA.dum[data.logit.inov$burden_memA.dum==0]) # 969 0's
length(data.logit.inov$burden_memA.dum[data.logit.inov$burden_memA.dum==1]) # 500 1's
#### so it worked

zelig.logit.inov.burden <- zelig(burden_memA.dum ~ female + committee_chair + educ_level2_nums + p_diputadolocal
                                 + p_feddeputy +  p_senador + p_statepartyleader + p_natpartyleader
                                 + jcp + mesadirectiva + tier
                                 + prddummy + pandummy + pvemdummy + ptdummy + convdummy
                                 + nadummy + dum2003 + dum2006 + female2003 
                                 + female2006 + wnom1_dist_chambermed 
                                 + committee_secretary
                                 + party_leader + minorparties_dum2 + daysinoffice_log,
                                 data = data.logit.inov, model = "logit")

summary(zelig.logit.inov.burden)



########################################
################################################# LOGIT MODEL -  FOREIGN COMMITTEES
################### DV = foreign_memA

### distribution of original foreign_memA to double check with new dummy:

summary(data.logit.inov$foreign_memA)
length(data.logit.inov$foreign_memA[data.logit.inov$foreign_memA==0]) ### 1138 0's
length(data.logit.inov$foreign_memA[data.logit.inov$foreign_memA==1]) ### 286 1's
length(data.logit.inov$foreign_memA[data.logit.inov$foreign_memA==2]) ### 42 2's
length(data.logit.inov$foreign_memA[data.logit.inov$foreign_memA==3]) ### 3 3's
1138 + 286 + 42 + 3  # = 1469 so that matches our n

summary(is.na(data.logit.inov$foreign_memA)) ## no NA's

### so when we transform the variable into the new dummy, we will want 1138 0's and 331 1's
1138 + 331 # = 1469


##First we need to make foreign_memA a 0/1 dichotomous variable.

##Add new placeholding column to data set
data.logit.inov$foreign_memA.dum <- rep(15,nrow(data.logit.inov))##15 just a rando placeholder
is.numeric(data.logit.inov$foreign_memA.dum)

##Populate the new dummy, where TRUE will equal 1, FALSE will equal 0
data.logit.inov$foreign_memA.dum<-data.logit.inov$foreign_memA >= 1

##Turn these trues and falses into 1s and 0s with as.numeric
data.logit.inov$foreign_memA.dum<-as.numeric(data.logit.inov$foreign_memA.dum)

### to double check it worked
summary(data.logit.inov$foreign_memA.dum)
length(data.logit.inov$foreign_memA.dum[data.logit.inov$foreign_memA.dum==0]) # 1138 0's
length(data.logit.inov$foreign_memA.dum[data.logit.inov$foreign_memA.dum==1]) # 331 1's
#### so it worked

zelig.logit.inov.foreign <- zelig(foreign_memA.dum ~ female + committee_chair + educ_level2_nums + p_diputadolocal
                                  + p_feddeputy +  p_senador + p_statepartyleader + p_natpartyleader
                                  + jcp + mesadirectiva + tier
                                  + prddummy + pandummy + pvemdummy + ptdummy + convdummy
                                  + nadummy + dum2003 + dum2006 + female2003 
                                  + female2006 + wnom1_dist_chambermed 
                                  + committee_secretary
                                  + party_leader + minorparties_dum2 + daysinoffice_log,
                                  data = data.logit.inov, model = "logit")

summary(zelig.logit.inov.foreign)


########################################
################################################# LOGIT MODEL -  SOCIAL COMMITTEES
################### DV = social_memA

### distribution of original social_memA to double check with new dummy:

summary(data.logit.inov$social_memA)
length(data.logit.inov$social_memA[data.logit.inov$social_memA==0]) ### 1020 0's
length(data.logit.inov$social_memA[data.logit.inov$social_memA==1]) ### 355 1's
length(data.logit.inov$social_memA[data.logit.inov$social_memA==2]) ### 86 2's
length(data.logit.inov$social_memA[data.logit.inov$social_memA==3]) ### 8 3's
1020 + 355 + 86 + 8  # = 1469 so that matches our n

summary(is.na(data.logit.inov$social_memA)) ## no NA's

### so when we transform the variable into the new dummy, we will want 1020 0's and 449 1's
1020 + 449 # = 1469


##First we need to make foreign_memA a 0/1 dichotomous variable.


##Add new placeholding column to data set
data.logit.inov$social_memA.dum <- rep(15,nrow(data.logit.inov))##15 just a rando placeholder
is.numeric(data.logit.inov$social_memA.dum)

##Populate the new dummy, where TRUE will equal 1, FALSE will equal 0
data.logit.inov$social_memA.dum<-data.logit.inov$social_memA >= 1


##Turn these trues and falses into 1s and 0s with as.numeric
data.logit.inov$social_memA.dum<-as.numeric(data.logit.inov$social_memA.dum)

### to double check it worked
summary(data.logit.inov$social_memA.dum)
length(data.logit.inov$social_memA.dum[data.logit.inov$social_memA.dum==0]) # 1020 0's
length(data.logit.inov$social_memA.dum[data.logit.inov$social_memA.dum==1]) # 449 1's
#### so it worked

zelig.logit.inov.social <- zelig(social_memA.dum ~ female + committee_chair + educ_level2_nums + p_diputadolocal
                                 + p_feddeputy +  p_senador + p_statepartyleader + p_natpartyleader
                                 + jcp + mesadirectiva + tier
                                 + prddummy + pandummy + pvemdummy + ptdummy + convdummy
                                 + nadummy + dum2003 + dum2006 + female2003 
                                 + female2006 + wnom1_dist_chambermed 
                                 + committee_secretary
                                 + party_leader + minorparties_dum2 + daysinoffice_log,
                                 data = data.logit.inov, model = "logit")

summary(zelig.logit.inov.social)




#################################################
################################################# LOGIT MODELS   - FIRST DIFFERENCES 
#################################################

summary(data.logit.inov) ### to look at the median variables
### then plug median variables into x.male58.inov.women (etc.) below


########################################### 
###########################################  FIRST DIFFERENCES - WOMEN_MEMA
########################################### 



########################## 58th

x.male58.inov.women <- setx(zelig.logit.inov.women, female = 0, 
                            committee_chair = 0,
                            educ_level2_nums = 6, 
                            p_diputadolocal = 0, p_feddeputy = 0,
                            p_senador = 0, p_statepartyleader = 0,
                            p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                            tier = 0, prddummy = 0, pandummy = 0,
                            pvemdummy = 0, ptdummy = 0, convdummy = 0,
                            nadummy = 0, dum2003 = 0, dum2006 = 0,
                            female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                            committee_secretary = 0,
                            party_leader = 0,
                            minorparties_dum2 = 0,
                            daysinoffice_log = 6.998)


x.female58.inov.women <- setx(zelig.logit.inov.women, female = 1, 
                              committee_chair = 0,
                              educ_level2_nums = 6, 
                              p_diputadolocal = 0, p_feddeputy = 0,
                              p_senador = 0, p_statepartyleader = 0,
                              p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                              tier = 0, prddummy = 0, pandummy = 0,
                              pvemdummy = 0, ptdummy = 0, convdummy = 0,
                              nadummy = 0, dum2003 = 0, dum2006 = 0,
                              female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                              committee_secretary = 0,
                              party_leader = 0,
                              minorparties_dum2 = 0,
                              daysinoffice_log = 6.998)

fd.58.women_memA <- sim(zelig.logit.inov.women, x = x.male58.inov.women, x1 = x.female58.inov.women)
summary(fd.58.women_memA)


################################################################################ 59th

x.male59.inov.women <- setx(zelig.logit.inov.women, female = 0, 
                            committee_chair = 0,
                            educ_level2_nums = 6, 
                            p_diputadolocal = 0, p_feddeputy = 0,
                            p_senador = 0, p_statepartyleader = 0,
                            p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                            tier = 0, prddummy = 0, pandummy = 0,
                            pvemdummy = 0, ptdummy = 0, convdummy = 0,
                            nadummy = 0, dum2003 = 1, dum2006 = 0,
                            female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                            committee_secretary = 0,
                            party_leader = 0,
                            minorparties_dum2 = 0,
                            daysinoffice_log = 6.998)


x.female59.inov.women <- setx(zelig.logit.inov.women, female = 1, 
                              committee_chair = 0,
                              educ_level2_nums = 6, 
                              p_diputadolocal = 0, p_feddeputy = 0,
                              p_senador = 0, p_statepartyleader = 0,
                              p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                              tier = 0, prddummy = 0, pandummy = 0,
                              pvemdummy = 0, ptdummy = 0, convdummy = 0,
                              nadummy = 0, dum2003 = 1, dum2006 = 0,
                              female2003 = 1, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                              committee_secretary = 0,
                              party_leader = 0,
                              minorparties_dum2 = 0,
                              daysinoffice_log = 6.998)

fd.59.women_memA <- sim(zelig.logit.inov.women, x = x.male59.inov.women, x1 = x.female59.inov.women)
summary(fd.59.women_memA)


################################################################################ 60th

x.male60.inov.women <- setx(zelig.logit.inov.women, female = 0, 
                            committee_chair = 0,
                            educ_level2_nums = 6, 
                            p_diputadolocal = 0, p_feddeputy = 0,
                            p_senador = 0, p_statepartyleader = 0,
                            p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                            tier = 0, prddummy = 0, pandummy = 0,
                            pvemdummy = 0, ptdummy = 0, convdummy = 0,
                            nadummy = 0, dum2003 = 0, dum2006 = 1,
                            female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                            committee_secretary = 0,
                            party_leader = 0,
                            minorparties_dum2 = 0,
                            daysinoffice_log = 6.998)


x.female60.inov.women <- setx(zelig.logit.inov.women, female = 1, 
                              committee_chair = 0,
                              educ_level2_nums = 6, 
                              p_diputadolocal = 0, p_feddeputy = 0,
                              p_senador = 0, p_statepartyleader = 0,
                              p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                              tier = 0, prddummy = 0, pandummy = 0,
                              pvemdummy = 0, ptdummy = 0, convdummy = 0,
                              nadummy = 0, dum2003 = 0, dum2006 = 1,
                              female2003 = 0, female2006 = 1, wnom1_dist_chambermed = 0.4285,
                              committee_secretary = 0,
                              party_leader = 0,
                              minorparties_dum2 = 0,
                              daysinoffice_log = 6.998)

fd.60.women_memA <- sim(zelig.logit.inov.women, x = x.male60.inov.women, x1 = x.female60.inov.women)
summary(fd.60.women_memA)





########################################### 
###########################################  FIRST DIFFERENCES - SOCIAL COMMITTEE
########################################### 

########################## 58th

x.male58.inov.social <- setx(zelig.logit.inov.social, female = 0, 
                             committee_chair = 0,
                             educ_level2_nums = 6, 
                             p_diputadolocal = 0, p_feddeputy = 0,
                             p_senador = 0, p_statepartyleader = 0,
                             p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                             tier = 0, prddummy = 0, pandummy = 0,
                             pvemdummy = 0, ptdummy = 0, convdummy = 0,
                             nadummy = 0, dum2003 = 0, dum2006 = 0,
                             female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                             committee_secretary = 0,
                             party_leader = 0,
                             minorparties_dum2 = 0,
                             daysinoffice_log = 6.998)


x.female58.inov.social <- setx(zelig.logit.inov.social, female = 1, 
                               committee_chair = 0,
                               educ_level2_nums = 6, 
                               p_diputadolocal = 0, p_feddeputy = 0,
                               p_senador = 0, p_statepartyleader = 0,
                               p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                               tier = 0, prddummy = 0, pandummy = 0,
                               pvemdummy = 0, ptdummy = 0, convdummy = 0,
                               nadummy = 0, dum2003 = 0, dum2006 = 0,
                               female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                               committee_secretary = 0,
                               party_leader = 0,
                               minorparties_dum2 = 0,
                               daysinoffice_log = 6.998)

fd.58.social <- sim(zelig.logit.inov.social, x = x.male58.inov.social, x1 = x.female58.inov.social)
summary(fd.58.social)



########################## 59th

x.male59.inov.social <- setx(zelig.logit.inov.social, female = 0, 
                             committee_chair = 0,
                             educ_level2_nums = 6, 
                             p_diputadolocal = 0, p_feddeputy = 0,
                             p_senador = 0, p_statepartyleader = 0,
                             p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                             tier = 0, prddummy = 0, pandummy = 0,
                             pvemdummy = 0, ptdummy = 0, convdummy = 0,
                             nadummy = 0, dum2003 = 1, dum2006 = 0,
                             female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                             committee_secretary = 0,
                             party_leader = 0,
                             minorparties_dum2 = 0,
                             daysinoffice_log = 6.998)


x.female59.inov.social <- setx(zelig.logit.inov.social, female = 1, 
                               committee_chair = 0,
                               educ_level2_nums = 6, 
                               p_diputadolocal = 0, p_feddeputy = 0,
                               p_senador = 0, p_statepartyleader = 0,
                               p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                               tier = 0, prddummy = 0, pandummy = 0,
                               pvemdummy = 0, ptdummy = 0, convdummy = 0,
                               nadummy = 0, dum2003 = 1, dum2006 = 0,
                               female2003 = 1, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                               committee_secretary = 0,
                               party_leader = 0,
                               minorparties_dum2 = 0,
                               daysinoffice_log = 6.998)

fd.59.social <- sim(zelig.logit.inov.social, x = x.male59.inov.social, x1 = x.female59.inov.social)
summary(fd.59.social)


########################## 60th

x.male60.inov.social <- setx(zelig.logit.inov.social, female = 0, 
                             committee_chair = 0,
                             educ_level2_nums = 6, 
                             p_diputadolocal = 0, p_feddeputy = 0,
                             p_senador = 0, p_statepartyleader = 0,
                             p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                             tier = 0, prddummy = 0, pandummy = 0,
                             pvemdummy = 0, ptdummy = 0, convdummy = 0,
                             nadummy = 0, dum2003 = 0, dum2006 = 1,
                             female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                             committee_secretary = 0,
                             party_leader = 0,
                             minorparties_dum2 = 0,
                             daysinoffice_log = 6.998)


x.female60.inov.social <- setx(zelig.logit.inov.social, female = 1, 
                               committee_chair = 0,
                               educ_level2_nums = 6, 
                               p_diputadolocal = 0, p_feddeputy = 0,
                               p_senador = 0, p_statepartyleader = 0,
                               p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                               tier = 0, prddummy = 0, pandummy = 0,
                               pvemdummy = 0, ptdummy = 0, convdummy = 0,
                               nadummy = 0, dum2003 = 0, dum2006 = 1,
                               female2003 = 0, female2006 = 1, wnom1_dist_chambermed = 0.4285,
                               committee_secretary = 0,
                               party_leader = 0,
                               minorparties_dum2 = 0,
                               daysinoffice_log = 6.998)

fd.60.social <- sim(zelig.logit.inov.social, x = x.male60.inov.social, x1 = x.female60.inov.social)
summary(fd.60.social)



########################################### 
###########################################  FIRST DIFFERENCES - BURDEN COMMITTEE
########################################### 

########################## 58th

x.male58.inov.burden <- setx(zelig.logit.inov.burden, female = 0, 
                             committee_chair = 0,
                             educ_level2_nums = 6, 
                             p_diputadolocal = 0, p_feddeputy = 0,
                             p_senador = 0, p_statepartyleader = 0,
                             p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                             tier = 0, prddummy = 0, pandummy = 0,
                             pvemdummy = 0, ptdummy = 0, convdummy = 0,
                             nadummy = 0, dum2003 = 0, dum2006 = 0,
                             female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                             committee_secretary = 0,
                             party_leader = 0,
                             minorparties_dum2 = 0,
                             daysinoffice_log = 6.998)


x.female58.inov.burden <- setx(zelig.logit.inov.burden, female = 1, 
                               committee_chair = 0,
                               educ_level2_nums = 6, 
                               p_diputadolocal = 0, p_feddeputy = 0,
                               p_senador = 0, p_statepartyleader = 0,
                               p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                               tier = 0, prddummy = 0, pandummy = 0,
                               pvemdummy = 0, ptdummy = 0, convdummy = 0,
                               nadummy = 0, dum2003 = 0, dum2006 = 0,
                               female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                               committee_secretary = 0,
                               party_leader = 0,
                               minorparties_dum2 = 0,
                               daysinoffice_log = 6.998)

fd.58.burden_memA <- sim(zelig.logit.inov.burden, x = x.male58.inov.burden, x1 = x.female58.inov.burden)
summary(fd.58.burden_memA)


########################## 59th

x.male59.inov.burden <- setx(zelig.logit.inov.burden, female = 0, 
                             committee_chair = 0,
                             educ_level2_nums = 6, 
                             p_diputadolocal = 0, p_feddeputy = 0,
                             p_senador = 0, p_statepartyleader = 0,
                             p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                             tier = 0, prddummy = 0, pandummy = 0,
                             pvemdummy = 0, ptdummy = 0, convdummy = 0,
                             nadummy = 0, dum2003 = 1, dum2006 = 0,
                             female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                             committee_secretary = 0,
                             party_leader = 0,
                             minorparties_dum2 = 0,
                             daysinoffice_log = 6.998)


x.female59.inov.burden <- setx(zelig.logit.inov.burden, female = 1, 
                               committee_chair = 0,
                               educ_level2_nums = 6, 
                               p_diputadolocal = 0, p_feddeputy = 0,
                               p_senador = 0, p_statepartyleader = 0,
                               p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                               tier = 0, prddummy = 0, pandummy = 0,
                               pvemdummy = 0, ptdummy = 0, convdummy = 0,
                               nadummy = 0, dum2003 = 1, dum2006 = 0,
                               female2003 = 1, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                               committee_secretary = 0,
                               party_leader = 0,
                               minorparties_dum2 = 0,
                               daysinoffice_log = 6.998)

fd.59.burden_memA <- sim(zelig.logit.inov.burden, x = x.male59.inov.burden, x1 = x.female59.inov.burden)
summary(fd.59.burden_memA)


########################## 60th

x.male60.inov.burden <- setx(zelig.logit.inov.burden, female = 0, 
                             committee_chair = 0,
                             educ_level2_nums = 6, 
                             p_diputadolocal = 0, p_feddeputy = 0,
                             p_senador = 0, p_statepartyleader = 0,
                             p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                             tier = 0, prddummy = 0, pandummy = 0,
                             pvemdummy = 0, ptdummy = 0, convdummy = 0,
                             nadummy = 0, dum2003 = 0, dum2006 = 1,
                             female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                             committee_secretary = 0,
                             party_leader = 0,
                             minorparties_dum2 = 0,
                             daysinoffice_log = 6.998)


x.female60.inov.burden <- setx(zelig.logit.inov.burden, female = 1, 
                               committee_chair = 0,
                               educ_level2_nums = 6, 
                               p_diputadolocal = 0, p_feddeputy = 0,
                               p_senador = 0, p_statepartyleader = 0,
                               p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                               tier = 0, prddummy = 0, pandummy = 0,
                               pvemdummy = 0, ptdummy = 0, convdummy = 0,
                               nadummy = 0, dum2003 = 0, dum2006 = 1,
                               female2003 = 0, female2006 = 1, wnom1_dist_chambermed = 0.4285,
                               committee_secretary = 0,
                               party_leader = 0,
                               minorparties_dum2 = 0,
                               daysinoffice_log = 6.998)

fd.60.burden_memA <- sim(zelig.logit.inov.burden, x = x.male60.inov.burden, x1 = x.female60.inov.burden)
summary(fd.60.burden_memA)





########################################### 
###########################################  FIRST DIFFERENCES - POWER COMMITTEE
########################################### 

########################## 58th

x.male58.inov.power <- setx(zelig.logit.inov.power, female = 0, 
                            committee_chair = 0,
                            educ_level2_nums = 6, 
                            p_diputadolocal = 0, p_feddeputy = 0,
                            p_senador = 0, p_statepartyleader = 0,
                            p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                            tier = 0, prddummy = 0, pandummy = 0,
                            pvemdummy = 0, ptdummy = 0, convdummy = 0,
                            nadummy = 0, dum2003 = 0, dum2006 = 0,
                            female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                            committee_secretary = 0,
                            party_leader = 0,
                            minorparties_dum2 = 0,
                            daysinoffice_log = 6.998)


x.female58.inov.power <- setx(zelig.logit.inov.power, female = 1, 
                              committee_chair = 0,
                              educ_level2_nums = 6, 
                              p_diputadolocal = 0, p_feddeputy = 0,
                              p_senador = 0, p_statepartyleader = 0,
                              p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                              tier = 0, prddummy = 0, pandummy = 0,
                              pvemdummy = 0, ptdummy = 0, convdummy = 0,
                              nadummy = 0, dum2003 = 0, dum2006 = 0,
                              female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                              committee_secretary = 0,
                              party_leader = 0,
                              minorparties_dum2 = 0,
                              daysinoffice_log = 6.998)

fd.58.power <- sim(zelig.logit.inov.power, x = x.male58.inov.power, x1 = x.female58.inov.power)
summary(fd.58.power)


########################## 59th

x.male59.inov.power <- setx(zelig.logit.inov.power, female = 0, 
                            committee_chair = 0,
                            educ_level2_nums = 6, 
                            p_diputadolocal = 0, p_feddeputy = 0,
                            p_senador = 0, p_statepartyleader = 0,
                            p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                            tier = 0, prddummy = 0, pandummy = 0,
                            pvemdummy = 0, ptdummy = 0, convdummy = 0,
                            nadummy = 0, dum2003 = 1, dum2006 = 0,
                            female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                            committee_secretary = 0,
                            party_leader = 0,
                            minorparties_dum2 = 0,
                            daysinoffice_log = 6.998)


x.female59.inov.power <- setx(zelig.logit.inov.power, female = 1, 
                              committee_chair = 0,
                              educ_level2_nums = 6, 
                              p_diputadolocal = 0, p_feddeputy = 0,
                              p_senador = 0, p_statepartyleader = 0,
                              p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                              tier = 0, prddummy = 0, pandummy = 0,
                              pvemdummy = 0, ptdummy = 0, convdummy = 0,
                              nadummy = 0, dum2003 = 1, dum2006 = 0,
                              female2003 = 1, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                              committee_secretary = 0,
                              party_leader = 0,
                              minorparties_dum2 = 0,
                              daysinoffice_log = 6.998)

fd.59.power <- sim(zelig.logit.inov.power, x = x.male59.inov.power, x1 = x.female59.inov.power)
summary(fd.59.power)


########################## 60th

x.male60.inov.power <- setx(zelig.logit.inov.power, female = 0, 
                            committee_chair = 0,
                            educ_level2_nums = 6, 
                            p_diputadolocal = 0, p_feddeputy = 0,
                            p_senador = 0, p_statepartyleader = 0,
                            p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                            tier = 0, prddummy = 0, pandummy = 0,
                            pvemdummy = 0, ptdummy = 0, convdummy = 0,
                            nadummy = 0, dum2003 = 0, dum2006 = 1,
                            female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                            committee_secretary = 0,
                            party_leader = 0,
                            minorparties_dum2 = 0,
                            daysinoffice_log = 6.998)


x.female60.inov.power <- setx(zelig.logit.inov.power, female = 1, 
                              committee_chair = 0,
                              educ_level2_nums = 6, 
                              p_diputadolocal = 0, p_feddeputy = 0,
                              p_senador = 0, p_statepartyleader = 0,
                              p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                              tier = 0, prddummy = 0, pandummy = 0,
                              pvemdummy = 0, ptdummy = 0, convdummy = 0,
                              nadummy = 0, dum2003 = 0, dum2006 = 1,
                              female2003 = 0, female2006 = 1, wnom1_dist_chambermed = 0.4285,
                              committee_secretary = 0,
                              party_leader = 0,
                              minorparties_dum2 = 0,
                              daysinoffice_log = 6.998)

fd.60.power <- sim(zelig.logit.inov.power, x = x.male60.inov.power, x1 = x.female60.inov.power)
summary(fd.60.power)





########################################### 
###########################################  FIRST DIFFERENCES - ECONOMICS COMMITTEE
########################################### 

########################## 58th

x.male58.inov.econ <- setx(zelig.logit.inov.econ, female = 0, 
                           committee_chair = 0,
                           educ_level2_nums = 6, 
                           p_diputadolocal = 0, p_feddeputy = 0,
                           p_senador = 0, p_statepartyleader = 0,
                           p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                           tier = 0, prddummy = 0, pandummy = 0,
                           pvemdummy = 0, ptdummy = 0, convdummy = 0,
                           nadummy = 0, dum2003 = 0, dum2006 = 0,
                           female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                           committee_secretary = 0,
                           party_leader = 0,
                           minorparties_dum2 = 0,
                           daysinoffice_log = 6.998)


x.female58.inov.econ <- setx(zelig.logit.inov.econ, female = 1, 
                             committee_chair = 0,
                             educ_level2_nums = 6, 
                             p_diputadolocal = 0, p_feddeputy = 0,
                             p_senador = 0, p_statepartyleader = 0,
                             p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                             tier = 0, prddummy = 0, pandummy = 0,
                             pvemdummy = 0, ptdummy = 0, convdummy = 0,
                             nadummy = 0, dum2003 = 0, dum2006 = 0,
                             female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                             committee_secretary = 0,
                             party_leader = 0,
                             minorparties_dum2 = 0,
                             daysinoffice_log = 6.998)

fd.58.econ <- sim(zelig.logit.inov.econ, x = x.male58.inov.econ, x1 = x.female58.inov.econ)
summary(fd.58.econ)



########################## 59th

x.male59.inov.econ <- setx(zelig.logit.inov.econ, female = 0, 
                           committee_chair = 0,
                           educ_level2_nums = 6, 
                           p_diputadolocal = 0, p_feddeputy = 0,
                           p_senador = 0, p_statepartyleader = 0,
                           p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                           tier = 0, prddummy = 0, pandummy = 0,
                           pvemdummy = 0, ptdummy = 0, convdummy = 0,
                           nadummy = 0, dum2003 = 1, dum2006 = 0,
                           female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                           committee_secretary = 0,
                           party_leader = 0,
                           minorparties_dum2 = 0,
                           daysinoffice_log = 6.998)


x.female59.inov.econ <- setx(zelig.logit.inov.econ, female = 1, 
                             committee_chair = 0,
                             educ_level2_nums = 6, 
                             p_diputadolocal = 0, p_feddeputy = 0,
                             p_senador = 0, p_statepartyleader = 0,
                             p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                             tier = 0, prddummy = 0, pandummy = 0,
                             pvemdummy = 0, ptdummy = 0, convdummy = 0,
                             nadummy = 0, dum2003 = 1, dum2006 = 0,
                             female2003 = 1, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                             committee_secretary = 0,
                             party_leader = 0,
                             minorparties_dum2 = 0,
                             daysinoffice_log = 6.998)

fd.59.econ <- sim(zelig.logit.inov.econ, x = x.male59.inov.econ, x1 = x.female59.inov.econ)
summary(fd.59.econ)



########################## 60th

x.male60.inov.econ <- setx(zelig.logit.inov.econ, female = 0, 
                           committee_chair = 0,
                           educ_level2_nums = 6, 
                           p_diputadolocal = 0, p_feddeputy = 0,
                           p_senador = 0, p_statepartyleader = 0,
                           p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                           tier = 0, prddummy = 0, pandummy = 0,
                           pvemdummy = 0, ptdummy = 0, convdummy = 0,
                           nadummy = 0, dum2003 = 0, dum2006 = 1,
                           female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                           committee_secretary = 0,
                           party_leader = 0,
                           minorparties_dum2 = 0,
                           daysinoffice_log = 6.998)


x.female60.inov.econ <- setx(zelig.logit.inov.econ, female = 1, 
                             committee_chair = 0,
                             educ_level2_nums = 6, 
                             p_diputadolocal = 0, p_feddeputy = 0,
                             p_senador = 0, p_statepartyleader = 0,
                             p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                             tier = 0, prddummy = 0, pandummy = 0,
                             pvemdummy = 0, ptdummy = 0, convdummy = 0,
                             nadummy = 0, dum2003 = 0, dum2006 = 1,
                             female2003 = 0, female2006 = 1, wnom1_dist_chambermed = 0.4285,
                             committee_secretary = 0,
                             party_leader = 0,
                             minorparties_dum2 = 0,
                             daysinoffice_log = 6.998)

fd.60.econ <- sim(zelig.logit.inov.econ, x = x.male60.inov.econ, x1 = x.female60.inov.econ)
summary(fd.60.econ)




########################################### 
###########################################  FIRST DIFFERENCES - FOREIGN COMMITTEE
########################################### 

########################## 58th

x.male58.inov.foreign <- setx(zelig.logit.inov.foreign, female = 0, 
                              committee_chair = 0,
                              educ_level2_nums = 6, 
                              p_diputadolocal = 0, p_feddeputy = 0,
                              p_senador = 0, p_statepartyleader = 0,
                              p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                              tier = 0, prddummy = 0, pandummy = 0,
                              pvemdummy = 0, ptdummy = 0, convdummy = 0,
                              nadummy = 0, dum2003 = 0, dum2006 = 0,
                              female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                              committee_secretary = 0,
                              party_leader = 0,
                              minorparties_dum2 = 0,
                              daysinoffice_log = 6.998)


x.female58.inov.foreign <- setx(zelig.logit.inov.foreign, female = 1, 
                                committee_chair = 0,
                                educ_level2_nums = 6, 
                                p_diputadolocal = 0, p_feddeputy = 0,
                                p_senador = 0, p_statepartyleader = 0,
                                p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                                tier = 0, prddummy = 0, pandummy = 0,
                                pvemdummy = 0, ptdummy = 0, convdummy = 0,
                                nadummy = 0, dum2003 = 0, dum2006 = 0,
                                female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                                committee_secretary = 0,
                                party_leader = 0,
                                minorparties_dum2 = 0,
                                daysinoffice_log = 6.998)

fd.58.foreign <- sim(zelig.logit.inov.foreign, x = x.male58.inov.foreign, x1 = x.female58.inov.foreign)
summary(fd.58.foreign)




########################## 59th

x.male59.inov.foreign <- setx(zelig.logit.inov.foreign, female = 0, 
                              committee_chair = 0,
                              educ_level2_nums = 6, 
                              p_diputadolocal = 0, p_feddeputy = 0,
                              p_senador = 0, p_statepartyleader = 0,
                              p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                              tier = 0, prddummy = 0, pandummy = 0,
                              pvemdummy = 0, ptdummy = 0, convdummy = 0,
                              nadummy = 0, dum2003 = 1, dum2006 = 0,
                              female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                              committee_secretary = 0,
                              party_leader = 0,
                              minorparties_dum2 = 0,
                              daysinoffice_log = 6.998)


x.female59.inov.foreign <- setx(zelig.logit.inov.foreign, female = 1, 
                                committee_chair = 0,
                                educ_level2_nums = 6, 
                                p_diputadolocal = 0, p_feddeputy = 0,
                                p_senador = 0, p_statepartyleader = 0,
                                p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                                tier = 0, prddummy = 0, pandummy = 0,
                                pvemdummy = 0, ptdummy = 0, convdummy = 0,
                                nadummy = 0, dum2003 = 1, dum2006 = 0,
                                female2003 = 1, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                                committee_secretary = 0,
                                party_leader = 0,
                                minorparties_dum2 = 0,
                                daysinoffice_log = 6.998)

fd.59.foreign <- sim(zelig.logit.inov.foreign, x = x.male59.inov.foreign, x1 = x.female59.inov.foreign)
summary(fd.59.foreign)




########################## 60th

x.male60.inov.foreign <- setx(zelig.logit.inov.foreign, female = 0, 
                              committee_chair = 0,
                              educ_level2_nums = 6, 
                              p_diputadolocal = 0, p_feddeputy = 0,
                              p_senador = 0, p_statepartyleader = 0,
                              p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                              tier = 0, prddummy = 0, pandummy = 0,
                              pvemdummy = 0, ptdummy = 0, convdummy = 0,
                              nadummy = 0, dum2003 = 0, dum2006 = 1,
                              female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                              committee_secretary = 0,
                              party_leader = 0,
                              minorparties_dum2 = 0,
                              daysinoffice_log = 6.998)


x.female60.inov.foreign <- setx(zelig.logit.inov.foreign, female = 1, 
                                committee_chair = 0,
                                educ_level2_nums = 6, 
                                p_diputadolocal = 0, p_feddeputy = 0,
                                p_senador = 0, p_statepartyleader = 0,
                                p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                                tier = 0, prddummy = 0, pandummy = 0,
                                pvemdummy = 0, ptdummy = 0, convdummy = 0,
                                nadummy = 0, dum2003 = 0, dum2006 = 1,
                                female2003 = 0, female2006 = 1, wnom1_dist_chambermed = 0.4285,
                                committee_secretary = 0,
                                party_leader = 0,
                                minorparties_dum2 = 0,
                                daysinoffice_log = 6.998)

fd.60.foreign <- sim(zelig.logit.inov.foreign, x = x.male60.inov.foreign, x1 = x.female60.inov.foreign)
summary(fd.60.foreign)



#######################################
#######################################  PART 2:  ORDERED LOGIT

install.packages("ZeligChoice")
library("ZeligChoice")


##### This uses the same dataset as for our logit models:

library(foreign)
data <- read.dta("JOPgender_replication_minversion.dta")

data.logit.inov <- data[data$unit_individual==0 & 
                          data$alternate==0,]


##Coding new education variable as numeric again:
data.logit.inov$educ_level2_nums <- as.numeric(data.logit.inov$educ_level2)


#### pulling out the columns we need

data.logit.inov <- data.logit.inov[,c("women_memA","burden_memA", "economic_memA", "foreign_memA", 
                                      "issue_memA", "power_memA", "social_memA", "female", "committee_chair", 
                                      "educ_level2_nums", "p_diputadolocal",
                                      "p_feddeputy", "p_senador", "p_statepartyleader",
                                      "p_natpartyleader", "jcp", "mesadirectiva", 
                                      "tier", "prddummy", "pandummy", "pvemdummy", 
                                      "ptdummy", "convdummy", "nadummy", "dum2003", 
                                      "dum2006", "female2003", "female2006", 
                                      "wnom1_dist_chambermed", "committee_secretary",
                                      "party_leader", "minorparties_dum2",
                                      "daysinoffice_log")]

### removing NAs: started with 1503
### so originally this gives us 33 columns, we will add more as we create new dummy variables
data.logit.inov <- na.omit(data.logit.inov) ## now have 1469


#######################################


### first checking to make sure there are male and female observations
### for each value of number of committee
### the cases where it is a problem will be re-coded below:

table(data.logit.inov$female, data.logit.inov$women_memA)  ## problem
table(data.logit.inov$female, data.logit.inov$social_memA)  ### not a problem
table(data.logit.inov$female, data.logit.inov$burden_memA)  ### problem
table(data.logit.inov$female, data.logit.inov$power_memA)  ### not a problem
table(data.logit.inov$female, data.logit.inov$foreign_memA)  ###problem
table(data.logit.inov$female, data.logit.inov$economic_memA)  ## problem



##########################
##########################
############################# FOREIGN

## from cross tab we can see there are only men in the category 3 committees:

table(data.logit.inov$female, data.logit.inov$foreign_memA) 
#      0   1   2   3
# 0 903 229  34   3
# 1 235  57   8   0


# so we need to recode those 3 observations so that instead of being on 3 committees, they are on 2 committees.
## otherwise we will be dropping them from the analysis entirely.
## Though it does introduce some bias to reclassify them as 2 instead of 3, this is surely much less bias
### than would be introduced by dropping them from the analysis entirely.  


data.ordered.foreign <- data.logit.inov 
data.ordered.foreign$foreign_memA[data.ordered.foreign$foreign_memA==3] <- 2

table(data.ordered.foreign$female, data.ordered.foreign$foreign_memA) ## worked!
### so now the 3 men who had 3 committees have been added to the 2 category
## so instead of 34 men with 2, now we have 37

### running the model:

zelig.ord.logit.foreign <- zelig(foreign_memA ~ female + committee_chair + educ_level2_nums + p_diputadolocal
                                 + p_feddeputy +  p_senador + p_statepartyleader + p_natpartyleader
                                 + jcp + mesadirectiva + tier
                                 + prddummy + pandummy + pvemdummy + ptdummy + convdummy
                                 + nadummy + dum2003 + dum2006 + female2003 
                                 + female2006 + wnom1_dist_chambermed 
                                 + committee_secretary
                                 + party_leader + minorparties_dum2 + daysinoffice_log,
                                 data = data.ordered.foreign, model = "ologit")

summary(zelig.ord.logit.foreign)



########################################## POWER

table(data.logit.inov$female, data.logit.inov$power_memA)

#       0   1   2   3
#       0 805 279  79   6
#       1 226  57  14   3

zelig.ord.logit.power <- zelig(power_memA ~ female + committee_chair + educ_level2_nums + p_diputadolocal
                               + p_feddeputy +  p_senador + p_statepartyleader + p_natpartyleader
                               + jcp + mesadirectiva + tier
                               + prddummy + pandummy + pvemdummy + ptdummy + convdummy
                               + nadummy + dum2003 + dum2006 + female2003 
                               + female2006 + wnom1_dist_chambermed 
                               + committee_secretary
                               + party_leader + minorparties_dum2 + daysinoffice_log,
                               data = data.logit.inov, model = "ologit")

summary(zelig.ord.logit.power)


########################################## ECONOMIC

table(data.logit.inov$female, data.logit.inov$economic_memA)

#    0   1   2   3
# 0 766 340  61   2
# 1 225  68   7   0

### so we need to recode the 2 men who had 3 meetings and recode them as having 2
### so we should end up with 63 men who are on 2 committees


data.ordered.econ <- data.logit.inov 
data.ordered.econ$economic_memA[data.ordered.econ$economic_memA==3] <- 2

table(data.ordered.econ$female, data.ordered.econ$economic_memA) # worked

#     0   1   2
# 0 766 340  63
# 1 225  68   7



zelig.ord.logit.econ <- zelig(economic_memA ~ female + committee_chair + educ_level2_nums + p_diputadolocal
                              + p_feddeputy +  p_senador + p_statepartyleader + p_natpartyleader
                              + jcp + mesadirectiva + tier
                              + prddummy + pandummy + pvemdummy + ptdummy + convdummy
                              + nadummy + dum2003 + dum2006 + female2003 
                              + female2006 + wnom1_dist_chambermed 
                              + committee_secretary
                              + party_leader + minorparties_dum2 + daysinoffice_log,
                              data = data.ordered.econ, model = "ologit")

summary(zelig.ord.logit.econ)



######################################################## SOCIAL

table(data.logit.inov$female, data.logit.inov$social_memA)  ### no need to recode

zelig.ord.logit.social <- zelig(social_memA ~ female + committee_chair + educ_level2_nums + p_diputadolocal
                                + p_feddeputy +  p_senador + p_statepartyleader + p_natpartyleader
                                + jcp + mesadirectiva + tier
                                + prddummy + pandummy + pvemdummy + ptdummy + convdummy
                                + nadummy + dum2003 + dum2006 + female2003 
                                + female2006 + wnom1_dist_chambermed 
                                + committee_secretary
                                + party_leader + minorparties_dum2 + daysinoffice_log,
                                data = data.logit.inov, model = "ologit")

summary(zelig.ord.logit.social)



######################################################## BURDEN

table(data.logit.inov$female, data.logit.inov$burden_memA) # so recode the one 3 into a 2

#       0   1   2   3
#   0 795 320  54   0
#   1 174 113  12   1



data.ordered.burden <- data.logit.inov 
data.ordered.burden$burden_memA[data.ordered.burden$burden_memA==3] <- 2

table(data.ordered.burden$female, data.ordered.burden$burden_memA) ## worked

#       0   1   2
#   0 795 320  54
#   1 174 113  13

zelig.ord.logit.burden <- zelig(burden_memA ~ female + committee_chair + educ_level2_nums + p_diputadolocal
                                + p_feddeputy +  p_senador + p_statepartyleader + p_natpartyleader
                                + jcp + mesadirectiva + tier
                                + prddummy + pandummy + pvemdummy + ptdummy + convdummy
                                + nadummy + dum2003 + dum2006 + female2003 
                                + female2006 + wnom1_dist_chambermed 
                                + committee_secretary
                                + party_leader + minorparties_dum2 + daysinoffice_log,
                                data = data.ordered.burden, model = "ologit")

summary(zelig.ord.logit.burden)

################################################### 
################################################### 
###################################################  FIRST DIFFERENCES - ORDERED LOGIT
################################################### 
################################################### 



########################################### FOREIGN


########################## 58th

x.male58.ord.logit.foreign <- setx(zelig.ord.logit.foreign, female = 0, 
                                   committee_chair = 0,
                                   educ_level2_nums = 6, 
                                   p_diputadolocal = 0, p_feddeputy = 0,
                                   p_senador = 0, p_statepartyleader = 0,
                                   p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                                   tier = 0, prddummy = 0, pandummy = 0,
                                   pvemdummy = 0, ptdummy = 0, convdummy = 0,
                                   nadummy = 0, dum2003 = 0, dum2006 = 0,
                                   female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                                   committee_secretary = 0,
                                   party_leader = 0,
                                   minorparties_dum2 = 0,
                                   daysinoffice_log = 6.998)


x.female58.ord.logit.foreign <- setx(zelig.ord.logit.foreign, female = 1, 
                                     committee_chair = 0,
                                     educ_level2_nums = 6, 
                                     p_diputadolocal = 0, p_feddeputy = 0,
                                     p_senador = 0, p_statepartyleader = 0,
                                     p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                                     tier = 0, prddummy = 0, pandummy = 0,
                                     pvemdummy = 0, ptdummy = 0, convdummy = 0,
                                     nadummy = 0, dum2003 = 0, dum2006 = 0,
                                     female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                                     committee_secretary = 0,
                                     party_leader = 0,
                                     minorparties_dum2 = 0,
                                     daysinoffice_log = 6.998)

fd.58.ord.logit.foreign <- sim(zelig.ord.logit.foreign, x = x.male58.ord.logit.foreign, x1 = x.female58.ord.logit.foreign)
summary(fd.58.ord.logit.foreign)



########################## 59th

x.male59.ord.logit.foreign <- setx(zelig.ord.logit.foreign, female = 0, 
                                   committee_chair = 0,
                                   educ_level2_nums = 6, 
                                   p_diputadolocal = 0, p_feddeputy = 0,
                                   p_senador = 0, p_statepartyleader = 0,
                                   p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                                   tier = 0, prddummy = 0, pandummy = 0,
                                   pvemdummy = 0, ptdummy = 0, convdummy = 0,
                                   nadummy = 0, dum2003 = 1, dum2006 = 0,
                                   female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                                   committee_secretary = 0,
                                   party_leader = 0,
                                   minorparties_dum2 = 0,
                                   daysinoffice_log = 6.998)


x.female59.ord.logit.foreign <- setx(zelig.ord.logit.foreign, female = 1, 
                                     committee_chair = 0,
                                     educ_level2_nums = 6, 
                                     p_diputadolocal = 0, p_feddeputy = 0,
                                     p_senador = 0, p_statepartyleader = 0,
                                     p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                                     tier = 0, prddummy = 0, pandummy = 0,
                                     pvemdummy = 0, ptdummy = 0, convdummy = 0,
                                     nadummy = 0, dum2003 = 1, dum2006 = 0,
                                     female2003 = 1, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                                     committee_secretary = 0,
                                     party_leader = 0,
                                     minorparties_dum2 = 0,
                                     daysinoffice_log = 6.998)

fd.59.ord.logit.foreign <- sim(zelig.ord.logit.foreign, x = x.male59.ord.logit.foreign, x1 = x.female59.ord.logit.foreign)
summary(fd.59.ord.logit.foreign)


########################## 60th

x.male60.ord.logit.foreign <- setx(zelig.ord.logit.foreign, female = 0, 
                                   committee_chair = 0,
                                   educ_level2_nums = 6, 
                                   p_diputadolocal = 0, p_feddeputy = 0,
                                   p_senador = 0, p_statepartyleader = 0,
                                   p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                                   tier = 0, prddummy = 0, pandummy = 0,
                                   pvemdummy = 0, ptdummy = 0, convdummy = 0,
                                   nadummy = 0, dum2003 = 0, dum2006 = 1,
                                   female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                                   committee_secretary = 0,
                                   party_leader = 0,
                                   minorparties_dum2 = 0,
                                   daysinoffice_log = 6.998)


x.female60.ord.logit.foreign <- setx(zelig.ord.logit.foreign, female = 1, 
                                     committee_chair = 0,
                                     educ_level2_nums = 6, 
                                     p_diputadolocal = 0, p_feddeputy = 0,
                                     p_senador = 0, p_statepartyleader = 0,
                                     p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                                     tier = 0, prddummy = 0, pandummy = 0,
                                     pvemdummy = 0, ptdummy = 0, convdummy = 0,
                                     nadummy = 0, dum2003 = 0, dum2006 = 1,
                                     female2003 = 0, female2006 = 1, wnom1_dist_chambermed = 0.4285,
                                     committee_secretary = 0,
                                     party_leader = 0,
                                     minorparties_dum2 = 0,
                                     daysinoffice_log = 6.998)

fd.60.ord.logit.foreign <- sim(zelig.ord.logit.foreign, x = x.male60.ord.logit.foreign, x1 = x.female60.ord.logit.foreign)
summary(fd.60.ord.logit.foreign)




########################################### POWER


########################## 58th

x.male58.ord.logit.power <- setx(zelig.ord.logit.power, female = 0, 
                                 committee_chair = 0,
                                 educ_level2_nums = 6, 
                                 p_diputadolocal = 0, p_feddeputy = 0,
                                 p_senador = 0, p_statepartyleader = 0,
                                 p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                                 tier = 0, prddummy = 0, pandummy = 0,
                                 pvemdummy = 0, ptdummy = 0, convdummy = 0,
                                 nadummy = 0, dum2003 = 0, dum2006 = 0,
                                 female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                                 committee_secretary = 0,
                                 party_leader = 0,
                                 minorparties_dum2 = 0,
                                 daysinoffice_log = 6.998)


x.female58.ord.logit.power <- setx(zelig.ord.logit.power, female = 1, 
                                   committee_chair = 0,
                                   educ_level2_nums = 6, 
                                   p_diputadolocal = 0, p_feddeputy = 0,
                                   p_senador = 0, p_statepartyleader = 0,
                                   p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                                   tier = 0, prddummy = 0, pandummy = 0,
                                   pvemdummy = 0, ptdummy = 0, convdummy = 0,
                                   nadummy = 0, dum2003 = 0, dum2006 = 0,
                                   female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                                   committee_secretary = 0,
                                   party_leader = 0,
                                   minorparties_dum2 = 0,
                                   daysinoffice_log = 6.998)

fd.58.ord.logit.power <- sim(zelig.ord.logit.power, x = x.male58.ord.logit.power, x1 = x.female58.ord.logit.power)
summary(fd.58.ord.logit.power)



########################## 59th - 

x.male59.ord.logit.power <- setx(zelig.ord.logit.power, female = 0, 
                                 committee_chair = 0,
                                 educ_level2_nums = 6, 
                                 p_diputadolocal = 0, p_feddeputy = 0,
                                 p_senador = 0, p_statepartyleader = 0,
                                 p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                                 tier = 0, prddummy = 0, pandummy = 0,
                                 pvemdummy = 0, ptdummy = 0, convdummy = 0,
                                 nadummy = 0, dum2003 = 1, dum2006 = 0,
                                 female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                                 committee_secretary = 0,
                                 party_leader = 0,
                                 minorparties_dum2 = 0,
                                 daysinoffice_log = 6.998)


x.female59.ord.logit.power <- setx(zelig.ord.logit.power, female = 1, 
                                   committee_chair = 0,
                                   educ_level2_nums = 6, 
                                   p_diputadolocal = 0, p_feddeputy = 0,
                                   p_senador = 0, p_statepartyleader = 0,
                                   p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                                   tier = 0, prddummy = 0, pandummy = 0,
                                   pvemdummy = 0, ptdummy = 0, convdummy = 0,
                                   nadummy = 0, dum2003 = 1, dum2006 = 0,
                                   female2003 = 1, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                                   committee_secretary = 0,
                                   party_leader = 0,
                                   minorparties_dum2 = 0,
                                   daysinoffice_log = 6.998)

fd.59.ord.logit.power <- sim(zelig.ord.logit.power, x = x.male59.ord.logit.power, x1 = x.female59.ord.logit.power)
summary(fd.59.ord.logit.power)



########################## 60th  

x.male60.ord.logit.power <- setx(zelig.ord.logit.power, female = 0, 
                                 committee_chair = 0,
                                 educ_level2_nums = 6, 
                                 p_diputadolocal = 0, p_feddeputy = 0,
                                 p_senador = 0, p_statepartyleader = 0,
                                 p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                                 tier = 0, prddummy = 0, pandummy = 0,
                                 pvemdummy = 0, ptdummy = 0, convdummy = 0,
                                 nadummy = 0, dum2003 = 0, dum2006 = 1,
                                 female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                                 committee_secretary = 0,
                                 party_leader = 0,
                                 minorparties_dum2 = 0,
                                 daysinoffice_log = 6.998)


x.female60.ord.logit.power <- setx(zelig.ord.logit.power, female = 1, 
                                   committee_chair = 0,
                                   educ_level2_nums = 6, 
                                   p_diputadolocal = 0, p_feddeputy = 0,
                                   p_senador = 0, p_statepartyleader = 0,
                                   p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                                   tier = 0, prddummy = 0, pandummy = 0,
                                   pvemdummy = 0, ptdummy = 0, convdummy = 0,
                                   nadummy = 0, dum2003 = 0, dum2006 = 1,
                                   female2003 = 0, female2006 = 1, wnom1_dist_chambermed = 0.4285,
                                   committee_secretary = 0,
                                   party_leader = 0,
                                   minorparties_dum2 = 0,
                                   daysinoffice_log = 6.998)

fd.60.ord.logit.power <- sim(zelig.ord.logit.power, x = x.male60.ord.logit.power, x1 = x.female60.ord.logit.power)
summary(fd.60.ord.logit.power)


########################################### ECONOMIC


########################## 58th

x.male58.ord.logit.econ <- setx(zelig.ord.logit.econ, female = 0, 
                                committee_chair = 0,
                                educ_level2_nums = 6, 
                                p_diputadolocal = 0, p_feddeputy = 0,
                                p_senador = 0, p_statepartyleader = 0,
                                p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                                tier = 0, prddummy = 0, pandummy = 0,
                                pvemdummy = 0, ptdummy = 0, convdummy = 0,
                                nadummy = 0, dum2003 = 0, dum2006 = 0,
                                female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                                committee_secretary = 0,
                                party_leader = 0,
                                minorparties_dum2 = 0,
                                daysinoffice_log = 6.998)


x.female58.ord.logit.econ <- setx(zelig.ord.logit.econ, female = 1, 
                                  committee_chair = 0,
                                  educ_level2_nums = 6, 
                                  p_diputadolocal = 0, p_feddeputy = 0,
                                  p_senador = 0, p_statepartyleader = 0,
                                  p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                                  tier = 0, prddummy = 0, pandummy = 0,
                                  pvemdummy = 0, ptdummy = 0, convdummy = 0,
                                  nadummy = 0, dum2003 = 0, dum2006 = 0,
                                  female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                                  committee_secretary = 0,
                                  party_leader = 0,
                                  minorparties_dum2 = 0,
                                  daysinoffice_log = 6.998)

fd.58.ord.logit.econ <- sim(zelig.ord.logit.econ, x = x.male58.ord.logit.econ, x1 = x.female58.ord.logit.econ)
summary(fd.58.ord.logit.econ)




########################## 59th

x.male59.ord.logit.econ <- setx(zelig.ord.logit.econ, female = 0, 
                                committee_chair = 0,
                                educ_level2_nums = 6, 
                                p_diputadolocal = 0, p_feddeputy = 0,
                                p_senador = 0, p_statepartyleader = 0,
                                p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                                tier = 0, prddummy = 0, pandummy = 0,
                                pvemdummy = 0, ptdummy = 0, convdummy = 0,
                                nadummy = 0, dum2003 = 1, dum2006 = 0,
                                female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                                committee_secretary = 0,
                                party_leader = 0,
                                minorparties_dum2 = 0,
                                daysinoffice_log = 6.998)


x.female59.ord.logit.econ <- setx(zelig.ord.logit.econ, female = 1, 
                                  committee_chair = 0,
                                  educ_level2_nums = 6, 
                                  p_diputadolocal = 0, p_feddeputy = 0,
                                  p_senador = 0, p_statepartyleader = 0,
                                  p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                                  tier = 0, prddummy = 0, pandummy = 0,
                                  pvemdummy = 0, ptdummy = 0, convdummy = 0,
                                  nadummy = 0, dum2003 = 1, dum2006 = 0,
                                  female2003 = 1, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                                  committee_secretary = 0,
                                  party_leader = 0,
                                  minorparties_dum2 = 0,
                                  daysinoffice_log = 6.998)

fd.59.ord.logit.econ <- sim(zelig.ord.logit.econ, x = x.male59.ord.logit.econ, x1 = x.female59.ord.logit.econ)
summary(fd.59.ord.logit.econ)





########################## 60th

x.male60.ord.logit.econ <- setx(zelig.ord.logit.econ, female = 0, 
                                committee_chair = 0,
                                educ_level2_nums = 6, 
                                p_diputadolocal = 0, p_feddeputy = 0,
                                p_senador = 0, p_statepartyleader = 0,
                                p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                                tier = 0, prddummy = 0, pandummy = 0,
                                pvemdummy = 0, ptdummy = 0, convdummy = 0,
                                nadummy = 0, dum2003 = 0, dum2006 = 1,
                                female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                                committee_secretary = 0,
                                party_leader = 0,
                                minorparties_dum2 = 0,
                                daysinoffice_log = 6.998)


x.female60.ord.logit.econ <- setx(zelig.ord.logit.econ, female = 1, 
                                  committee_chair = 0,
                                  educ_level2_nums = 6, 
                                  p_diputadolocal = 0, p_feddeputy = 0,
                                  p_senador = 0, p_statepartyleader = 0,
                                  p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                                  tier = 0, prddummy = 0, pandummy = 0,
                                  pvemdummy = 0, ptdummy = 0, convdummy = 0,
                                  nadummy = 0, dum2003 = 0, dum2006 = 1,
                                  female2003 = 0, female2006 = 1, wnom1_dist_chambermed = 0.4285,
                                  committee_secretary = 0,
                                  party_leader = 0,
                                  minorparties_dum2 = 0,
                                  daysinoffice_log = 6.998)

fd.60.ord.logit.econ <- sim(zelig.ord.logit.econ, x = x.male60.ord.logit.econ, x1 = x.female60.ord.logit.econ)
summary(fd.60.ord.logit.econ)



########################################### SOCIAL


########################## 58th

x.male58.ord.logit.social <- setx(zelig.ord.logit.social, female = 0, 
                                  committee_chair = 0,
                                  educ_level2_nums = 6, 
                                  p_diputadolocal = 0, p_feddeputy = 0,
                                  p_senador = 0, p_statepartyleader = 0,
                                  p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                                  tier = 0, prddummy = 0, pandummy = 0,
                                  pvemdummy = 0, ptdummy = 0, convdummy = 0,
                                  nadummy = 0, dum2003 = 0, dum2006 = 0,
                                  female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                                  committee_secretary = 0,
                                  party_leader = 0,
                                  minorparties_dum2 = 0,
                                  daysinoffice_log = 6.998)


x.female58.ord.logit.social <- setx(zelig.ord.logit.social, female = 1, 
                                    committee_chair = 0,
                                    educ_level2_nums = 6, 
                                    p_diputadolocal = 0, p_feddeputy = 0,
                                    p_senador = 0, p_statepartyleader = 0,
                                    p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                                    tier = 0, prddummy = 0, pandummy = 0,
                                    pvemdummy = 0, ptdummy = 0, convdummy = 0,
                                    nadummy = 0, dum2003 = 0, dum2006 = 0,
                                    female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                                    committee_secretary = 0,
                                    party_leader = 0,
                                    minorparties_dum2 = 0,
                                    daysinoffice_log = 6.998)

fd.58.ord.logit.social <- sim(zelig.ord.logit.social, x = x.male58.ord.logit.social, x1 = x.female58.ord.logit.social)
summary(fd.58.ord.logit.social)



########################## 59th

x.male59.ord.logit.social <- setx(zelig.ord.logit.social, female = 0, 
                                  committee_chair = 0,
                                  educ_level2_nums = 6, 
                                  p_diputadolocal = 0, p_feddeputy = 0,
                                  p_senador = 0, p_statepartyleader = 0,
                                  p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                                  tier = 0, prddummy = 0, pandummy = 0,
                                  pvemdummy = 0, ptdummy = 0, convdummy = 0,
                                  nadummy = 0, dum2003 = 1, dum2006 = 0,
                                  female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                                  committee_secretary = 0,
                                  party_leader = 0,
                                  minorparties_dum2 = 0,
                                  daysinoffice_log = 6.998)


x.female59.ord.logit.social <- setx(zelig.ord.logit.social, female = 1, 
                                    committee_chair = 0,
                                    educ_level2_nums = 6, 
                                    p_diputadolocal = 0, p_feddeputy = 0,
                                    p_senador = 0, p_statepartyleader = 0,
                                    p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                                    tier = 0, prddummy = 0, pandummy = 0,
                                    pvemdummy = 0, ptdummy = 0, convdummy = 0,
                                    nadummy = 0, dum2003 = 1, dum2006 = 0,
                                    female2003 = 1, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                                    committee_secretary = 0,
                                    party_leader = 0,
                                    minorparties_dum2 = 0,
                                    daysinoffice_log = 6.998)

fd.59.ord.logit.social <- sim(zelig.ord.logit.social, x = x.male59.ord.logit.social, x1 = x.female59.ord.logit.social)
summary(fd.59.ord.logit.social)



########################## 60th

x.male60.ord.logit.social <- setx(zelig.ord.logit.social, female = 0, 
                                  committee_chair = 0,
                                  educ_level2_nums = 6, 
                                  p_diputadolocal = 0, p_feddeputy = 0,
                                  p_senador = 0, p_statepartyleader = 0,
                                  p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                                  tier = 0, prddummy = 0, pandummy = 0,
                                  pvemdummy = 0, ptdummy = 0, convdummy = 0,
                                  nadummy = 0, dum2003 = 0, dum2006 = 1,
                                  female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                                  committee_secretary = 0,
                                  party_leader = 0,
                                  minorparties_dum2 = 0,
                                  daysinoffice_log = 6.998)


x.female60.ord.logit.social <- setx(zelig.ord.logit.social, female = 1, 
                                    committee_chair = 0,
                                    educ_level2_nums = 6, 
                                    p_diputadolocal = 0, p_feddeputy = 0,
                                    p_senador = 0, p_statepartyleader = 0,
                                    p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                                    tier = 0, prddummy = 0, pandummy = 0,
                                    pvemdummy = 0, ptdummy = 0, convdummy = 0,
                                    nadummy = 0, dum2003 = 0, dum2006 = 1,
                                    female2003 = 0, female2006 = 1, wnom1_dist_chambermed = 0.4285,
                                    committee_secretary = 0,
                                    party_leader = 0,
                                    minorparties_dum2 = 0,
                                    daysinoffice_log = 6.998)

fd.60.ord.logit.social <- sim(zelig.ord.logit.social, x = x.male60.ord.logit.social, x1 = x.female60.ord.logit.social)
summary(fd.60.ord.logit.social)



########################################### BURDEN


########################## 58th

x.male58.ord.logit.burden <- setx(zelig.ord.logit.burden, female = 0, 
                                  committee_chair = 0,
                                  educ_level2_nums = 6, 
                                  p_diputadolocal = 0, p_feddeputy = 0,
                                  p_senador = 0, p_statepartyleader = 0,
                                  p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                                  tier = 0, prddummy = 0, pandummy = 0,
                                  pvemdummy = 0, ptdummy = 0, convdummy = 0,
                                  nadummy = 0, dum2003 = 0, dum2006 = 0,
                                  female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                                  committee_secretary = 0,
                                  party_leader = 0,
                                  minorparties_dum2 = 0,
                                  daysinoffice_log = 6.998)


x.female58.ord.logit.burden <- setx(zelig.ord.logit.burden, female = 1, 
                                    committee_chair = 0,
                                    educ_level2_nums = 6, 
                                    p_diputadolocal = 0, p_feddeputy = 0,
                                    p_senador = 0, p_statepartyleader = 0,
                                    p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                                    tier = 0, prddummy = 0, pandummy = 0,
                                    pvemdummy = 0, ptdummy = 0, convdummy = 0,
                                    nadummy = 0, dum2003 = 0, dum2006 = 0,
                                    female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                                    committee_secretary = 0,
                                    party_leader = 0,
                                    minorparties_dum2 = 0,
                                    daysinoffice_log = 6.998)

fd.58.ord.logit.burden <- sim(zelig.ord.logit.burden, x = x.male58.ord.logit.burden, x1 = x.female58.ord.logit.burden)
summary(fd.58.ord.logit.burden)


########################## 59th

x.male59.ord.logit.burden <- setx(zelig.ord.logit.burden, female = 0, 
                                  committee_chair = 0,
                                  educ_level2_nums = 6, 
                                  p_diputadolocal = 0, p_feddeputy = 0,
                                  p_senador = 0, p_statepartyleader = 0,
                                  p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                                  tier = 0, prddummy = 0, pandummy = 0,
                                  pvemdummy = 0, ptdummy = 0, convdummy = 0,
                                  nadummy = 0, dum2003 = 1, dum2006 = 0,
                                  female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                                  committee_secretary = 0,
                                  party_leader = 0,
                                  minorparties_dum2 = 0,
                                  daysinoffice_log = 6.998)


x.female59.ord.logit.burden <- setx(zelig.ord.logit.burden, female = 1, 
                                    committee_chair = 0,
                                    educ_level2_nums = 6, 
                                    p_diputadolocal = 0, p_feddeputy = 0,
                                    p_senador = 0, p_statepartyleader = 0,
                                    p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                                    tier = 0, prddummy = 0, pandummy = 0,
                                    pvemdummy = 0, ptdummy = 0, convdummy = 0,
                                    nadummy = 0, dum2003 = 1, dum2006 = 0,
                                    female2003 = 1, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                                    committee_secretary = 0,
                                    party_leader = 0,
                                    minorparties_dum2 = 0,
                                    daysinoffice_log = 6.998)

fd.59.ord.logit.burden <- sim(zelig.ord.logit.burden, x = x.male59.ord.logit.burden, x1 = x.female59.ord.logit.burden)
summary(fd.59.ord.logit.burden)



########################## 60th

x.male60.ord.logit.burden <- setx(zelig.ord.logit.burden, female = 0, 
                                  committee_chair = 0,
                                  educ_level2_nums = 6, 
                                  p_diputadolocal = 0, p_feddeputy = 0,
                                  p_senador = 0, p_statepartyleader = 0,
                                  p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                                  tier = 0, prddummy = 0, pandummy = 0,
                                  pvemdummy = 0, ptdummy = 0, convdummy = 0,
                                  nadummy = 0, dum2003 = 0, dum2006 = 1,
                                  female2003 = 0, female2006 = 0, wnom1_dist_chambermed = 0.4285,
                                  committee_secretary = 0,
                                  party_leader = 0,
                                  minorparties_dum2 = 0,
                                  daysinoffice_log = 6.998)


x.female60.ord.logit.burden <- setx(zelig.ord.logit.burden, female = 1, 
                                    committee_chair = 0,
                                    educ_level2_nums = 6, 
                                    p_diputadolocal = 0, p_feddeputy = 0,
                                    p_senador = 0, p_statepartyleader = 0,
                                    p_natpartyleader = 0, jcp = 0, mesadirectiva = 0,
                                    tier = 0, prddummy = 0, pandummy = 0,
                                    pvemdummy = 0, ptdummy = 0, convdummy = 0,
                                    nadummy = 0, dum2003 = 0, dum2006 = 1,
                                    female2003 = 0, female2006 = 1, wnom1_dist_chambermed = 0.4285,
                                    committee_secretary = 0,
                                    party_leader = 0,
                                    minorparties_dum2 = 0,
                                    daysinoffice_log = 6.998)

fd.60.ord.logit.burden <- sim(zelig.ord.logit.burden, x = x.male60.ord.logit.burden, x1 = x.female60.ord.logit.burden)
summary(fd.60.ord.logit.burden)

